<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "tme_merchandisecinfo".
 *
 * @property integer $ID
 * @property string $MerchandiseCID
 * @property integer $MerchandisePID
 * @property string $MerchandiseCName
 * @property integer $SortID
 * @property integer $State
 *
 * @property TmeMerchandiseinfo[] $tmeMerchandiseinfos
 */
class TmeMerchandisecinfo extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tme_merchandisecinfo';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['MerchandiseCID','MerchandiseCName'], 'required'],
            ['ID','string'],
            [['MerchandisePID','SortID', 'State'], 'integer'],
            [['MerchandiseCID'], 'string', 'max' => 10],
            [['MerchandiseCName'], 'string', 'max' => 50]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'MerchandiseCID' => 'Merchandise Cid',
            'MerchandisePID' => 'Merchandise Pid',
            'MerchandiseCName' => 'Merchandise Cname',
            'SortID' => 'Sort ID',
            'State' => 'State',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTmeMerchandiseinfos()
    {
        return $this->hasMany(TmeMerchandiseinfo::className(), ['MerchandiseCID' => 'MerchandiseCID']);
    }
}
